1bashThis demonstrates how to prompt the user for input, read it, and use the input in a script.echo "What's your name?" read name # Note that we didn't need to declare a new variable. echo "Hello, $name!"bash internaldata manipulationsother variable featuresvariable assignment
2bashThis demonstrates capturing a single keystroke from the user without requiring them to press Enter.read -n 1 answer # Just one characterbash internaldata manipulationsother variable featuresvariable assignment
3bashThis demonstrates reading user input in a Bash script and echoing it back.echo -n "Proceed? [y/n]: " read -r answer echo "$answer"bash internaldata manipulationsother variable featuresvariable assignment
4bashThis demonstrates assignment a value from standard input.read -p "password:" PASSWORDbash internaldata manipulationsother variable featuresvariable assignment
5bashThis demonstrates capturing user input from standard input and storing it in a variable.read foobash internaldata manipulationsother variable featuresvariable assignment